package com.example.demo.controller;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

import com.example.demo.model.User;
import com.example.demo.service.TestUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yujie
 * @create 2018-04-26 下午3:45
 **/
@RestController
public class TestController {
    @Autowired
    private TestUserService testUserService;

    @GetMapping("/test")
    public User abc(String a) throws Exception {
        Map<String, String> m = new HashMap<>();
        m.put("a", a);
        System.out.println(testUserService.st());

        return testUserService.getUser(m);
        //return userService.getUser(m);
    }


    @GetMapping("/del")
    public User bcd(String a) {
        testUserService.delete();
        return null;
    }

    @PostMapping("/test1")
    public Object test1(String userName, Integer age) {
        return "{\"userName\":\"" + userName + "\",\"age\":" + age + "}";
    }
}
